//
//  UIColor+Random.m
//  Perking
//
//  Created by longmin on 16/7/15.
//  Copyright © 2016年 tim. All rights reserved.
//

#import "UIColor+Random.h"

#define kZeroCOLOR kRGBCOLOR(252,231,0)
#define kOneCOLOR kRGBCOLOR(255,177,112)
#define kTwoCOLOR kRGBCOLOR(255,111,32)
#define kThreeCOLOR kRGBCOLOR(251,69,88)
#define kFourCOLOR kRGBCOLOR(0,174,204)
#define kFiveCOLOR kRGBCOLOR(75,200,182)
#define kSixCOLOR kRGBCOLOR(102,189,43)
#define kSevenCOLOR kRGBCOLOR(194,231,112)
#define kEightCOLOR kRGBCOLOR(159,83,35)
#define kNineCOLOR kRGBCOLOR(255,199,14)
#define kTenCOLOR kRGBCOLOR(176,128,208)
#define kElevenCOLOR kRGBCOLOR(117,47,165)
@implementation UIColor (Random)

+(UIColor *)colorWithPhoneNum:(long long)phoneNum
{
    int colorNum = phoneNum % 12;
    UIColor *resultColor;
    switch (colorNum) {
        case 0:
            resultColor = kZeroCOLOR;
            break;
        case 1:
            resultColor = kOneCOLOR;
            break;
        case 2:
            resultColor = kTwoCOLOR;
            break;
        case 3:
            resultColor = kThreeCOLOR;
            break;
        case 4:
            resultColor = kFourCOLOR;
            break;
        case 5:
            resultColor = kFiveCOLOR;
            break;
        case 6:
            resultColor = kSixCOLOR;
            break;
        case 7:
            resultColor = kSevenCOLOR;
            break;
        case 8:
            resultColor = kEightCOLOR;
            break;
        case 9:
            resultColor = kNineCOLOR;
            break;
        case 10:
            resultColor = kTenCOLOR;
            break;
        case 11:
            resultColor = kElevenCOLOR;
            break;
        default:
            break;
    }
    return resultColor;
//    CGFloat hue = ( phoneNum % 256 / 256.0 ); //0.0 to 1.0
//    CGFloat saturation = ( phoneNum % 128 / 256.0 ) + 0.5; // 0.5 to 1.0,away from white
//    CGFloat brightness = ( phoneNum % 110 / 256.0 ) + 0.5; //0.5 to 1.0,away from black
//    return [UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:1];
}

@end
